package nc.bs.hr.poorder.pub.ipm;

import nc.bs.framework.common.NCLocator;
import nc.bs.hr.utli.BaseDAOUtliJM;
import nc.bs.hr.utli.CBaseDAO;
import nc.hr.vo.TSrmSupplyRelation;
import nc.itf.single.pub.TSrmSupplyRelationSave;
import nc.itf.vrm.relat.IVendorstock;
import nc.jdbc.framework.processor.ColumnProcessor;
import nc.vo.pub.BusinessException;
import nc.vo.pub.VOStatus;
import nc.vo.vrm.relat.VendorstockHeaderVO;

public class TSrmSupplyRelationSaveIpm implements TSrmSupplyRelationSave {
	private IVendorstock bo = (IVendorstock)NCLocator.getInstance().lookup(IVendorstock.class);

	public void insert_RequiresNew(VendorstockHeaderVO[] inserts,TSrmSupplyRelation data) throws BusinessException {
		String cuserid = (String) BaseDAOUtliJM.getNC().executeQuery("select cuserid from sm_user where user_code='luojh1'", new ColumnProcessor());
		
		 
		 if((VOStatus.NEW)==(inserts[0].getStatus())){
			 bo.updateHeadArrayGt(inserts, null, null, cuserid);
			 
		 }else {
			 bo.updateHeadArrayGt(null, inserts, null, cuserid);
		}
		 insertJM_RequiresNew(data);
		 
	}

	public void insertJM_RequiresNew(TSrmSupplyRelation data)throws BusinessException {
		CBaseDAO.updateVOhyqd(data);
	}

	public void upDataJM_RequiresNew(String sql) throws BusinessException {
		BaseDAOUtliJM.getBase().executeUpdate(sql);
		
	}

}
